<template>
    <div class="list-content">
        <input type="hidden" v-model="matter=matters">
        <div class="el-card" style="margin-top:12px;" v-for="item in matter">
            <div class="ct-main">
                <div class="main-source">
                    来自：<a>{{ item.source }}</a>
                </div>
                <div class="main-content">
                    <a class="avatar-link" href="">
                        <img class="avatar-img" src="https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2033397853,2413356146&fm=117&gp=0.jpg" />
                    </a>
                    <h2 class="c-title"><a class="c-title-a">{{ item.title }}</a></h2>
                    <div class="c-book">
                        <div class="cb-main">
                            <div class="cb-main-m">
                                <img class="cb-main-m-img" src="https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=397488172,233027493&fm=23&gp=0.jpg" />
                                <span class="cb-main-m-title">{{ item.author }}</span>
                                {{ item.content }}
                            </div>
                        </div>
                    </div>
                    <div class="c-meta">2条评论</div>
                </div>
            </div>
        </div>
    </div>
</template>
<style>
    .list-content {
        margin-top: 5px;
        width: 650px;
    }
    .index-list {
        /*width: 650px;*/
        height: 232px;
        padding: 10px;
        margin-bottom: 10px;
        background: #fff;
        border: 1px solid #e7eaf1;
        border-radius: 2px;
        box-shadow: 0 1px 3px rgba(0,37,55,.05);
        box-sizing: border-box;
    }
    body {
        font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif;
        font-size: 13px;
        word-wrap: break-word;
        background-color: #fff;
    }
    h1,h2,h3,h4,h5 {
        color: #259;
        font-weight: 700;
        font-size: 14px;
        outline: 0;
    }
    body, ul, ol, li, p, h1, h2, h3, h4, h5 {
        margin: 0;
        padding: 0;
    }
    h2 {
        display: block;
        font-size: 1.5em;
        -webkit-margin-before: 0.83em;
        -webkit-margin-after: 0.83em;
        -webkit-margin-start: 0px;
        -webkit-margin-end: 0px;
        font-weight: bold;
    }
    .avatar-link {
        display: block;
        float: left;
        width: 38px;
        height: 38px;
        color: #999;
    }
    .avatar-img {
        width: 38px;
        height: 38px;
        border-radius: 4px;
    }
    .ct-main {
        margin-left: 45px;
    }
    .c-title {
        margin: 1;
        padding: 0;
    }
    .c-title-a {
        text-decoration: none;
    }
    .cb-main-m-img {
        float: left;
        height: 112px;
        width: 200px;
        border-radius: 4px;
        margin: 1px 10px 5px 0;
    }

</style>
<script>
  export default {
    props: {
        matters: {
            type: [Array, Object],
            default: []
        }
    },
    data() {
      return {
        matter: [],
        content: 'this is content...',
        source: 'north Ice.'
      };
    },
    methods: {
        getScrollData: function () {
            var mats = this.matter;
            $(window).scroll(function (){
                let scrollTop = $(this).scrollTop()
                let scrollHeight = $(document).height()
                let windowHeight = $(this).height()
                console.log(scrollTop, scrollHeight, windowHeight)
                if (scrollTop + windowHeight === scrollHeight) {
                    let x = {
                        title: 'xxx',
                        author: 'ccc',
                        content: 'ggg',
                        source: 'tokyo'
                    }
                    pushData(x)
                }
            })
        },
        pushData: function (mats) {
            this.matter.push(mats)
        }

    },
    mounted() {
        this.getScrollData()
    }
  };
</script>
